//呼吸灯如何控制
int ledPin = 2;
int button = 5;
bool bt_down = true;
void setup()
{
  Serial.begin(9600);
  pinMode(button , INPUT_PULLUP);
  pinMode(ledPin, OUTPUT);
  analogWrite(ledPin, 0);

}
void buch() {
  if (digitalRead(button) == 0) {
    bt_down = ! bt_down;
    Serial.println("button down!");
    Serial.print("bt_down"); Serial.println(bt_down);
    delay(200);
  }
}
void loop()
{
  buch();
  delay(10);

START: delay(10);
  while ( bt_down == true) {
    for (int i = 0; i <= 254; i++)
    {
      buch();
      if (bt_down == false) {
        delay(100);
        goto START;
      }
      analogWrite(ledPin, i * 2);
      delay(5);
    }
    for (int i = 254; i >= 0; i--)
    {
      buch();
      if (bt_down == false) {
        delay(100);
        goto START;
      }
      analogWrite(ledPin, i * 2 );
      delay(5);
    }
  }
  analogWrite(ledPin, 0);
}
